<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!Doctype html>
<html>
<head>
    <meta content="text/html" charset="utf-8">
    <title>党建</title>
    <meta name="keywords" content="务川,党建"/>
    <meta name="description" content="务川,党建"/>
    <link href="../../static/images/ico/favicon.png" rel="shortcut icon">
    <link rel="stylesheet" type="text/css" href="../../static/css/list.css">
    <script type="text/javascript" src="../../static/js/user/jq181.js"></script>
    <script type="text/javascript" src="../../static/js/user/list.js"></script>
    <script type="text/javascript" src="../../static/js/user/baseList.js"></script>

    <%--文件上传插件--%>
    <link href="../../sys/resources/scripts/XYTipsWindow/jquery.XYTipsWindow.2.8.css" rel="stylesheet"/>
    <link href="../../sys/resources/scripts/webuploader/webuploader.css" rel="stylesheet"/>
    <link href="../../sys/resources/scripts/webfilesuploader/webfilesuploader.css" rel="stylesheet"/>
    <script src="../../sys/resources/scripts/webuploader/webuploader.js"></script>
    <script src="../../sys/resources/scripts/XYTipsWindow/jquery.XYTipsWindow.2.8.js"></script>
    <script src="../../sys/resources/scripts/webfilesuploader/webfilesuploader.js"></script>
    <script src="../../static/js/user/portrait.js"></script>

    <link rel="stylesheet" type="text/css" href="../../sys/resources/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="../../sys/resources/css/bootstrap-datetimepicker.min.css">
    <link rel="stylesheet" href="../../sys/resources/css/grumble.css">


    <script type="text/javascript" src="../../sys/resources/scripts/bootstrap.js"></script>
    <script type="text/javascript" src="../../sys/resources/scripts/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="../../sys/resources/scripts/bootstrap-datetimepicker.zh-CN.js"></script>
    <script type="text/javascript" src="../../sys/resources/scripts/jquery.grumble.min.js"></script>
    <script type="text/javascript" src="../../sys/resources/scripts/zhBase.js"></script>
    <script type="text/javascript" src="../../sys/resources/scripts/zhForm.js"></script>
    <script charset="utf-8" src="../../sys/resources/scripts/kindeditor-4.1.1/kindeditor-min.js"></script>
    <script charset="utf-8" src="../../sys/resources/scripts/kindeditor-4.1.1/lang/zh_CN.js"></script>
    <script>
        $(function () {

            /**
             * 提交后的响应函数
             * @param data 服务器返回
             */
            function deal(data) {
                $("#portrait").attr("src",data.headurl);
                alert(data.msg);
            }

            var zf = new zhForm($("#formId"));
            $("#btnid").click(function () {
                var isSuccess = zf.verify();
                if (isSuccess) {
                    zf.submitForm(deal);
                }
            });
        });
    </script>
</head>
<body>
<c:if test="${empty sessionScope.sysUser}">
    <script type="text/javascript">
        alert("亲爱的用户，请先登录");
        window.location.href="/loginReg/login.do";
    </script>
</c:if>

<jsp:include page="../../themes/header.jsp"/>
<div id="middle">
    <div class="wrapper">
        <div id="middle-left-aside">
            <jsp:include page="left.jsp"/>
        </div>
        <div id="middle-right-content">
            <div class="news-content-wrapper">
                <div class="news-content-header">
                    <div>
                        <span></span>头像上传：<a href="/">首页</a> &gt; <a href="/privateinfo/portrait.do">我的党校</a> &gt; <a
                            href="/privateinfo/portrait.do">头像上传</a>
                    </div>
                    <span>头像上传</span>
                </div>
                <ul class="news-content-list content-list">
                    <div class="panel-body">


                        <form action="/privateinfo/upload.do" id="formId" name="form" class="form-horizontal"
                              role="form">
                            <div class="row" style="margin-bottom: 20px">
                                <div class="col-xs-4">
                                </div>
                                <div class="col-xs-4">
                                    <c:choose>
                                        <c:when test="${not empty headurl}">
                                            <img id="portrait" src="${headurl}" width="120px" height="120px">
                                        </c:when>
                                        <c:otherwise>
                                            <img id="portrait" src="/static/images/default.gif" width="120px" height="120px">
                                        </c:otherwise>
                                    </c:choose>
                                </div>
                                <div class="col-xs-2">
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-xs-10">
                                    <div class="form-group">

                                        <input name="uid" type="hidden" value="${sysUser.uid}" />

                                        <label for="headurl" class="col-sm-3 control-label">选择头像</label>

                                        <div class="col-sm-7">
                                            <input name="headurl" type="hidden"  id="headurl" />
                                            <input name="headname" type="text" notNull="true" class="form-control" id="headname"
                                                   placeholder="原始文件名称" />
                                        </div>
                                        <div class="col-sm-2">
                                            <button id="fileBtn" type="button" class="btn btn-info btn-sm">选择头像</button>
                                        </div>
                                    </div>
                                </div>
                            </div>


                            <div class="row">
                                <div class="col-xs-4">
                                </div>
                                <div class="col-xs-3">
                                    <button type="button" id="btnid" class="btn btn-success btn-block">提交</button>
                                </div>
                                <div class="col-xs-6">
                                </div>
                            </div>
                        </form>
                    </div>
                </ul>
            </div>
        </div>
    </div>
</div>

<jsp:include page="../../themes/footer.jsp"/>

</body>
</html>